class item:
    def __init__(self,name,area):
        self.name = name
        self.area = area
    def __str__(self):
        return f"str家具类型：{self.name},家具面积：{self.area}"
    def __repr__(self):
        return f"repr家具类型：{self.name},家具面积：{self.area}"
        
class house:
    def __init__(self,name,area):
        self.name = name
        self.area = area
        self.free_area = area
        self.item = []
        self.hitem_name = []
    def add_item(self,item:item):
        if self.free_area < item.area:
            print("房间装不下该家具")
            return
        self.item.append(item)
        self.free_area -= item.area
        self.hitem_name.append(item.name)
        print("添加成功")
    def __str__(self):
        return f"房子名称:{self.name},总面积：{self.area},剩余面积{self.free_area},内含家具：{self.hitem_name}" 
              
sofa = item("沙发",18)
print(sofa)
room = item("床",50)
print(room)
table = item("桌子",10)
print(table)
chair = item("椅子",60)
print(chair)
house1 = house("深圳湾一号",100)
print(house1)
print("_______________________________")
house1.add_item(sofa)
house1.add_item(room)
house1.add_item(table)
print(house1)
print(house1.item)
